{% extends 'blog_base.htm' %}
{% block js %}
<script type="text/javascript" src="/static/js/switch.js"></script>
<script type="text/javascript" src="/static/js/MathJax/MathJax.js"></script>
{% endblock %}

{% block middle %}
<div id="navigation"> 
  <a href="../home">首页</a>->
  {%if blog.event %}
  <a href="../event/?event={{blog.event.key}}">{{blog.event.title}}</a> 
  {%else%}无事件相关
  {%endif%}
</div>
<div id="m1">
  <div class="title2" id="name_{{blog.key}}">{{blog.title}}</div>
  <p id="timenote"> 
	{{blog.publish_time|date:"Y-m-d H:i"}}|Tags:
	{% if tags %}
	{%for tag in blog_tags%}
	<a href="../blogview?tag={{tag.word}}">{{tag.word}}</a>&nbsp;
    {%endfor%}
	{%else%}无
	{%endif%}
	{%if is_admin%}|
	<a href="../editblog?blog={{blog.key}}">编辑</a>&nbsp;&nbsp;
	<a href="javascript:del_blog('{{blog.key}}')">删除</a>
	{%endif%}
  </p>
  <div id="blog_content">
	{% autoescape off %}
	{{blog.content}}
	{% endautoescape %}
  </div>
  <table width="98%" border="0" cellspacing="0" cellpadding="0" id="comment">
    <tr>
      <td id="comment_counter" class="dot_tridown">
		<a href="javascript:switch_comment()" class="a_raw">
		  共<span id="num_comment">{{count}}</span>条评论
		</a>
	  </td>
    </tr>
  </table>
  <div id="tbody_com" style="display:block;">
	<!--两个记录员，主要是为了Dom方式增加评论时，显示用户名和其url-->
    <input type="hidden" id="visitor_name" value="{{cur_user.nickname}}"/>
	{% for comment in comments%}
    <div class="each_comment" id="com_{{comment.key}}">
      <div class="com_info">
        <table>
          <tr>
            <td>#{{forloop.counter}}&nbsp;
			  <!--			  {{comment.sender.nickname}} -->
			  {{comment.sender}}
			  <span class="time">{{comment.publish_time|date:"Y-m-d H:i:s"}}</span>
			</td>
            {%if is_admin%}
            <td width="7%"><a href="javascript:del_comment('{{comment.key}}');">删除</a></td>
            {%endif%}
		  </tr>
        </table>
      </div>
      <p>{{comment.content}}</p>
    </div>
	{%endfor%}
  </div>
  <form action="." method="post">
	<table>
	  <tr>
		<td class="font" style="width:50px;height:42px;">Name：</td>
		<td>
		  <input type="text" name="sender" id="sender"
				 class="box_name" value="无名氏"/>  *
		</td>
	  </tr>
	  <tr>
		<td class="font_12">Comment：</td>
		<td><textarea class="box_comment" id="write_comment" ></textarea>
		</td>
      <tr>
		<td></td>
		<td>
		  <input type="button" value=" 提交评论 " onclick="submit_comment('{{blog.key}}')"/>
		</td>
	  </tr>
	</table>
  </form>
</div>

{%if is_admin%}
<div id="del_blog_confirm_box" style="display:none;">
  <input type="hidden" id="recorder_bkey"/><!--记录要删除日志的key-->
  <div>您确信要删除日志<span id="del_blog_name"></span>吗？</div>
  <div style="padding-top:8px;">
	<input type="button" value="确认" onclick="del_blog_real2()"/>
    <input type="button" value="取消" onclick="$('del_blog_confirm_box').hide();"/>
  </div>	
</div>
{%endif%}
{% endblock %} 
